package cn.org.xiaosheng.resttemplate;

import cn.org.xiaosheng.hutool.utils.GetUtils;
import com.alibaba.fastjson.JSONObject;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * @author XiaoSheng
 * @date 2023-11-17
 * @dec 描述
 */
@RestController
public class GetRestTest {

    @Resource
    private cn.org.xiaosheng.resttemplate.utils.GetUtils getUtils;

    @RequestMapping("/testRest1")
    public String getRestTest1() {
        Map<String, Object> headers = new HashMap<>();
        headers.put("tenant-id", "1");
        headers.put("Authorization", "Bearer test1");
        headers.put("client-type", "web");
        headers.put("Conten-Type", "x-www-form-urlencoded");
        Map<String, Object> params = new HashMap<>();
        params.put("pageNo", "1");
        params.put("pageSize", "10");
        ResponseEntity<JSONObject> response1 = getUtils.getRequest("http://xxxx/admin-api/operate/service-provider/page", headers, params);
        final ResponseEntity<JSONObject> response2 = getUtils.getRequest("http://xxxxxx/admin-api/operate/project-list/names", headers, params);
        System.out.println(response1);
        System.out.println(response2);
        return "success!";
    }
}
